<div [@routerTransition]>
    <div class="m-subheader">
        <div class="d-flex align-items-center">
            <div class="mr-auto col-sm-12 col-md-6">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>{{l("PaySettings")}}</span>
                </h3>
                <span class="m-section__sub">
                    {{l("SettingsHeaderInfo")}}
                </span>
            </div>
            <div class="col-sm-12 col-md-6 text-right">
                <button class="btn btn-primary" (click)="saveAll()"><i class="la la-floppy-o"></i> {{l("SaveAll")}}</button>
            </div>
        </div>
    </div>

    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <tabset class="tab-container" *ngIf="paySettings">
                    <tab *ngIf="true" heading="{{l('WeChatPay')}}" customClass="m-tabs__item">
                        <h5>{{l("WeChatPayInformation")}}</h5>
                        <div class="m-checkbox-list">
                            <label for="weChatPay_IsActive" class="m-checkbox">
                                <input id="weChatPay_IsActive" type="checkbox" name="weChatPay_IsActive" [(ngModel)]="paySettings.weChatPay.isActive">
                                {{l("IsActive")}}({{l("PayIsActiveExplain")}})
                                <span></span>
                            </label>
                        </div>
                        <div class="form-group">
                            <label for="weChatPay_AppId">{{l("WeChatAppId")}}</label>
                            <input id="weChatPay_AppId" type="text" name="weChatPay_AppId" class="form-control" [ngClass]="{'edited':paySettings.weChatPay.appId}" [(ngModel)]="paySettings.weChatPay.appId" maxlength="64">
                        </div>
                        <div class="form-group">
                            <label for="weChatPay_MchId">{{l("WeChatMchId")}}</label>
                            <input id="weChatPay_MchId" rows="5" name="weChatPay_MchId" class="form-control" [ngClass]="{'edited':paySettings.weChatPay.mchId}" [(ngModel)]="paySettings.weChatPay.mchId" maxlength="64">
                        </div>
                        <div class="form-group">
                            <label for="weChatPay_TenPayKey">{{l("WeChatTenPayKey")}}</label>
                            <input id="weChatPay_TenPayKey" type="text" name="weChatPay_TenPayKey" class="form-control" [ngClass]="{'edited':paySettings.weChatPay.tenPayKey}" [(ngModel)]="paySettings.weChatPay.tenPayKey" maxlength="200">
                        </div>
                        <div class="form-mgroup">
                            <label for="weChatPay_PayNotifyUrl">{{l("WeChatPayNotifyUrl")}}</label>
                            <textarea id="weChatPay_PayNotifyUrl" rows="5" name="weChat_PayPayNotifyUrl" class="form-control" [ngClass]="{'edited':paySettings.weChatPay.payNotifyUrl}" [(ngModel)]="paySettings.weChatPay.payNotifyUrl" maxlength="400"></textarea>
                        </div>
                    </tab>
                    <tab *ngIf="true" heading="{{l('AliPay')}}" customClass="m-tabs__item">
                        <h5>{{l("AliInformation")}}</h5>
                        <div class="m-checkbox-list">
                            <label for="aliPay_IsActive" class="m-checkbox">
                                <input id="aliPay_IsActive" type="checkbox" name="aliPay_IsActive" [(ngModel)]="paySettings.aliPay.isActive">
                                {{l("IsActive")}}({{l("PayIsActiveExplain")}})
                                <span></span>
                            </label>
                        </div>
                        <div class="form-group">
                            <label for="aliPay_AppId">{{l("AliAppId")}}</label>
                            <input id="aliPay_AppId" type="text" name="aliPay_AppId" class="form-control" [ngClass]="{'edited':paySettings.aliPay.appId}" [(ngModel)]="paySettings.aliPay.appId" maxlength="64">
                        </div>
                        <div class="form-group">
                            <label for="aliPay_Uid">{{l("AliUid")}}</label>
                            <input id="aliPay_Uid" rows="5" name="aliPay_Uid" class="form-control" [ngClass]="{'edited':paySettings.aliPay.uid}" [(ngModel)]="paySettings.aliPay.uid" maxlength="64">
                        </div>
                        <div class="form-group">
                            <label for="aliPay_Gatewayurl">{{l("AliGatewayurl")}}</label>
                            <textarea id="aliPay_Gatewayurl" rows="2" name="aliPay_Gatewayurl" class="form-control" [ngClass]="{'edited':paySettings.aliPay.gatewayurl}" [(ngModel)]="paySettings.aliPay.gatewayurl" maxlength="200">
                            </textarea>
                        </div>
                        <div class="form-mgroup">
                            <label for="aliPay_AlipayPublicKey">{{l("AlipayPublicKey")}}</label>
                            <textarea id="aliPay_AlipayPublicKey" rows="5" name="weChat_PayAlipayPublicKey" class="form-control" [ngClass]="{'edited':paySettings.aliPay.alipayPublicKey}" [(ngModel)]="paySettings.aliPay.alipayPublicKey" maxlength="400">
                            </textarea>
                        </div>
                        <div class="form-group">
                            <label for="aliPay_AlipaySignPublicKey">{{l("AlipaySignPublicKey")}}</label>
                            <textarea id="aliPay_AlipaySignPublicKey" rows="5" name="aliPay_AlipaySignPublicKey" class="form-control" [ngClass]="{'edited':paySettings.aliPay.alipaySignPublicKey}" [(ngModel)]="paySettings.aliPay.alipaySignPublicKey" maxlength="400">
                            </textarea>
                        </div>
                        <div class="form-group">
                            <label for="aliPay_PrivateKey">{{l("AliPrivateKey")}}</label>
                            <textarea id="aliPay_PrivateKey" rows="11" name="aliPay_PrivateKey" class="form-control" [ngClass]="{'edited':paySettings.aliPay.privateKey}" [(ngModel)]="paySettings.aliPay.privateKey" maxlength="400">
                            </textarea>
                        </div>
                        <div class="form-group">
                            <label for="aliPay_CharSet">{{l("AliCharSet")}}</label>
                            <input id="aliPay_CharSet" type="text" name="aliPay_CharSet" class="form-control" [ngClass]="{'edited':paySettings.aliPay.charSet}" [(ngModel)]="paySettings.aliPay.charSet">
                        </div>
                        <div class="form-group">
                            <label for="aliPay_Notify">{{l("AliNotify")}}</label>
                            <textarea id="aliPay_Notify" rows="2" name="aliPay_Notify" class="form-control" [ngClass]="{'edited':paySettings.aliPay.notify}" [(ngModel)]="paySettings.aliPay.notify" maxlength="200">
                            </textarea>
                        </div>
                        <div class="form-group">
                            <label for="aliPay_SignType">{{l("AliSignType")}}</label>
                            <input id="aliPay_SignType" type="text" name="aliPay_SignType" class="form-control" [ngClass]="{'edited':paySettings.aliPay.signType}" [(ngModel)]="paySettings.aliPay.signType">
                        </div>
                        <div class="m-checkbox-list">
                            <label for="aliPay_IsKeyFromFile" class="m-checkbox">
                                <input id="aliPay_IsKeyFromFile" type="checkbox" name="aliPay_IsKeyFromFile" [(ngModel)]="paySettings.aliPay.isKeyFromFile">
                                {{l("IsKeyFromFile")}}({{l("IsKeyFromFileExplain")}})
                                <span></span>
                            </label>
                        </div>
                    </tab>
                    <tab *ngIf="true" heading="{{l('GlobalAliPay')}}" customClass="m-tabs__item">
                        <h5>{{l("GlobalAliPayInformation")}}</h5>
                        <div class="m-checkbox-list">
                            <label for="globalAliPay_IsActive" class="m-checkbox">
                                <input id="globalAliPay_IsActive" type="checkbox" name="globalAliPay_IsActive" [(ngModel)]="paySettings.globalAliPay.isActive">
                                {{l("IsActive")}}({{l("PayIsActiveExplain")}})
                                <span></span>
                            </label>
                        </div>
                        <div class="form-group">
                            <label for="globalAliPay_Key">{{l("globalAliPay_Key")}}</label>
                            <input id="globalAliPay_Key" type="text" name="globalAliPay_Key" class="form-control" [ngClass]="{'edited':paySettings.globalAliPay.key}"
                                [(ngModel)]="paySettings.globalAliPay.key" maxlength="32">
                        </div>
                        <div class="form-group">
                            <label for="globalAliPay_Partner">{{l("globalAliPay_Partner")}}</label>
                            <input id="globalAliPay_Partner" type="text" name="globalAliPay_Partner" class="form-control" [ngClass]="{'edited':paySettings.globalAliPay.partner}"
                            [(ngModel)]="paySettings.globalAliPay.partner" maxlength="32">
                        </div>
                        <div class="form-group">
                            <label for="globalAliPay_Gatewayurl">{{l("AliGatewayurl")}}</label>
                            <textarea id="globalAliPay_Gatewayurl" rows="2" name="globalAliPay_Gatewayurl" class="form-control" [ngClass]="{'edited':paySettings.globalAliPay.gatewayurl}"
                                [(ngModel)]="paySettings.globalAliPay.gatewayurl" maxlength="200">
                            </textarea>
                        </div>
                        <div class="form-mgroup">
                            <label for="globalAliPay_Notify">{{l("globalAliPay_Notify")}}</label>
                            <textarea id="globalAliPay_Notify" rows="2" name="globalAliPay_Notify" class="form-control" [ngClass]="{'edited':paySettings.globalAliPay.notify}"
                                [(ngModel)]="paySettings.globalAliPay.notify" maxlength="200">
                            </textarea>
                        </div>
                        <div class="form-mgroup">
                            <label for="globalAliPay_ReturnUrl">{{l("globalAliPay_ReturnUrl")}}</label>
                            <textarea id="globalAliPay_ReturnUrl" rows="2" name="globalAliPay_ReturnUrl" class="form-control" [ngClass]="{'edited':paySettings.globalAliPay.returnUrl}"
                                [(ngModel)]="paySettings.globalAliPay.returnUrl" maxlength="200">
                            </textarea>
                        </div>

                        <div class="form-group">
                            <label for="globalAliPay_Currency">{{l("globalAliPay_Currency")}}</label>
                            <input id="globalAliPay_Currency" type="text" name="globalAliPay_Currency" class="form-control" [ngClass]="{'edited':paySettings.globalAliPay.currency}" [(ngModel)]="paySettings.globalAliPay.currency">
                        </div>

                        <div class="form-mgroup">
                            <div class="form-mgroup">
                                <div class="d-flex align-items-center">
                                    <div class="mr-auto col-xs-6">
                                        <h6 class="m-subheader__title m-subheader__title--separator">
                                            <span>{{l("splitFund")}}</span>
                                        </h6>
                                    </div>
                                    <div *ngIf="splitFunds.length<=4" class="col-sm-6 text-right">
                                        <button class="btn btn-primary blue" (click)="createSplitFundInfo()">
                                            <i class="fa fa-plus"></i>{{l("Create")}}
                                        </button>
                                    </div>
                                </div>
                            </div>
                            <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading" style="margin-top:10px;">
                                <p-table #dataTable (onLazyLoad)="getSplitFunds($event)"  [value]="primengTableHelper.records" rows="{{primengTableHelper.defaultRecordsCountPerPage}}"
                                    [paginator]="false" [lazy]="true" [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                                    [resizableColumns]="primengTableHelper.resizableColumns">
                                    <ng-template pTemplate="header">
                                        <tr>
                                            <th>{{l('Actions')}}</th>
                                            <th>
                                                {{l('TransIn')}}
                                            </th>
                                            <th>
                                                {{l('AmountRate')}}
                                            </th>
                                            <th>
                                                {{l('Desc')}}
                                            </th>
                                        </tr>
                                    </ng-template>
                                    <ng-template pTemplate="body" let-record="$implicit">
                                        <tr>
                                            <td>
                                                <div class="btn-group dropdown" dropdown container="body">
                                                    <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary">
                                                        <i class="fa fa-cog"></i><span class="caret"></span> {{l("Actions")}}
                                                    </button>
                                                    <ul class="dropdown-menu" *dropdownMenu>
                                                        <li>
                                                            <a href="javascript:;" (click)="editSplitFund(record)">{{l('Edit')}}</a>
                                                        </li>
                                                        <li>
                                                            <a href="javascript:;" (click)="deleteSplitFund(record)">{{l('Delete')}}</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </td>
                                            <td>
                                                {{record.transIn}}
                                            </td>
                                            <td>
                                                {{record.amountRate}}
                                            </td>
                                            <td>
                                                {{record.desc}}
                                            </td>
                                        </tr>
                                    </ng-template>
                                </p-table>
                                <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                                    {{l('NoData')}}
                                </div>
                            </div>
                            <!--<Primeng-TurboTable-End>-->
                        </div>
                    </tab>
                </tabset>
            </div>
        </div>
    </div>
    <createSplitFundInfoModal #createSplitFundInfoModal (modalSave)="createCallback($event)"></createSplitFundInfoModal>
    <editSplitFundInfoModal #editSplitFundInfoModal></editSplitFundInfoModal>
</div>

